<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %><%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt"  %>
<html><head>
<!--
Zeke Elder - zbe@andrew.cmu.edu
Amal Chemmany - achemman@andrew.cmu.edu
Nishant Kumar - nkumar1@andrew.cmu.edu
15-637
4/2/2012
--><title>Welcome to FitHub!</title>
<c:if test="${user == null}">
<c:redirect url="welcome.jsp"/>
</c:if>
<link href="css/groups.css" type="text/css" rel="stylesheet">
		<link rel="stylesheet" href="./css/colorbox.css" />
		<script src="./js/jquery.min.js"></script>
		<script src="./js/jquery.colorbox.js"></script>
		<script>
			$(document).ready(function(){
				$(".iframe").colorbox();
				$(".callbacks").colorbox({
					iframe:true, width:"70%", height:"80%",
					onClosed:function(){ window.location.reload(); }
				});
				
			});
		</script>
</head>

<body>
<!-- include header.jsp --> <jsp:include page="./header.jsp" flush="false" />
<div id="maindiv" class="body_container">
<div id="groups_bar">
<form action="search.html">
<table>
<tbody>
<tr>
<th colspan="4" id="groups_title"> Your Groups
</th>
</tr>
<c:forEach var="entry" items="${subscribedGroups}">
<tr>
<td class="group_name"><a href="./showGroupHome.do?groupId=${entry.group.groupId}">${entry.group.groupName}</a></td>
<td class="group_delete"> 
	<c:if test="${entry.group.adminId != entry.userId}">
		<a href="./leaveGroup.do?groupId=${entry.group.groupId}">leave</a>
	</c:if>
</td>
</tr>
</c:forEach>
</tbody>
</table>
</form>
</div>
<div id="people_bar">
<h1> Other Groups</h1>

<div class="centered_div"> 
<form action="searchGroup.do" method="post">
<h2> </h2><input id="searchGroup" name="searchGroup" type="text"><input value="search" id="search_person_submit" type="submit"></h2> 
</form>
<a class="callbacks" href="./groupadd.jsp">Create a New Group</a>
</div>
<div class="centered_div">
<table>
<tbody>
<c:forEach var="entry" items="${searchGroups}">
<tr >
<td rowspan="3" colspan="2"><h3> <a href="./showGroupHome.do?groupId=${entry.groupId}">${entry.groupName}</a> </h3></td> </tr>
<tr>
<td class="group_delete"> <a href="./joinGroup.do?groupId=${entry.groupId}">Join</a></td>
</tr>
<tr></tr>
</c:forEach>
</tbody>
</table>
</div>
</div>
</div>
</body></html>